import http from "@/api";
import { ResPage } from "@/api/interface";
import {
  ApiUserAccountCreate,
  ApiUserAccountDelete,
  ApiUserAccountSearch,
  ApiUserAccountUpdate,
  ApiUserAccountExport,
  ApiUserAccountImport,
  ApiUserAccountImportTemplateFile
} from "@/api/apis/user_account";
import { ReqSearch } from "@/api/interface/Search/ReqSearch";
import { dtoUserAccountCreate, dtoUserAccountDelete, dtoUserAccountInfo, dtoUserAccountUpdate } from "@/api/dbdto/dtoUserAccount";

export const requestUserAccountCreate = (params: dtoUserAccountCreate) => {
  return http.post(ApiUserAccountCreate, params);
};

export const requestUserAccountSearch = (params: ReqSearch) => {
  return http.post<ResPage<dtoUserAccountInfo>>(ApiUserAccountSearch, params);
};

export const requestUserAccountUpdate = (params: dtoUserAccountUpdate) => {
  return http.post(ApiUserAccountUpdate, params);
};

export const requestUserAccountDelete = (params: dtoUserAccountDelete) => {
  return http.post(ApiUserAccountDelete, params);
};

//导入数据
export const requestUserAccountImport = (params: FormData) => {
  return http.post(ApiUserAccountImport, params);
};

//获取导入数据文件模板
export const requestUserAccountTemplateFile = (params = {}) => {
  //,记得是download方法， md，使用post搞了半天
  return http.download(ApiUserAccountImportTemplateFile, {});
};

//导出数据
export const requestUserAccountExport = (params: ReqSearch) => {
  return http.download(ApiUserAccountExport, params);
};
